type Maybe[OK] union { None | OK }
type None native
public const None None native('__None')

public method
    Maybe.Bool Bool {
        when (this) {
            OK => Yes,
            None => No
        }
    }

public operator
    ??[T] { t? Maybe[T], fallback T } T {
        when (t?) {
            OK(t) => t,
            None => fallback
        }
    }

public operator
    map[A,B] { a? Maybe[A], f Lambda[A,B] } Maybe[B] {
        when (a?) {
            OK(a) => f(a),
            None => None
        }
    }

public operator
    flat-map[A,B] { a? Maybe[A], f Lambda[A,Maybe[B]] } Maybe[B] {
        when (a?) {
            OK(a) => f(a),
            None => None
        }
    }

public operator
    apply2[A,B,X] { ab? Pair[Maybe[A],Maybe[B]], f Lambda[Pair[A,B],X] } Maybe[X] {
        let (a?, b?) = ab?,
        \ flat-map a = a?,
        \ flat-map b = b?,
        f(a,b)
    }

public operator
    apply3[A,B,C,X] { abc? Triple[Maybe[A],Maybe[B],Maybe[C]], f Lambda[Triple[A,B,C],X] } Maybe[X] {
        let (a?, b?, c?) = abc?,
        \ flat-map a = a?,
        \ flat-map b = b?,
        \ flat-map c = c?,
        f(a,b,c)
    }


